<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2022/1/18
  Time: 14:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="common/head.jsp"%>
<html>
<head>
    <title>添加课程信息</title>
    <script src="../static/js/jquery-3.4.1.js"></script>
    <script>
        function addcourse1(){
            var addcourse1 = $("#addcourse1").serializeArray();
            alert(addcourse1)
            $.ajax({
                    url:"../user/addcourse",
                    data:addcourse1,
                    type:"get",
                    dataType:"json",
                    success:function(data){
                        alert(data)
                        if (data==true){
                            alert("添加课程信息成功");
                            location.href="/page/course"
                        }else {
                            alert("添加课程信息失败");
                            location.href="/page/addcourse";
                        }

                    }
            })
            return false;
        }
    </script>
</head>
<style>
    form,table{
        margin-left: auto;
        margin-right: auto;
        margin-top: 100px;
    }
    td{
        width: 200px;
        height: 20px;
        text-align: center;

    }
</style>
<body>
<%--240,248,255--%>
<form onsubmit="return addcourse1()" id="addcourse1" name="addcourse">
    <table  style="background-color: #f0f8ff;" border="1px solid red" cellspacing="0px"  >
        <caption><h2>添加课程信息</h2></caption>
        <tr>
            <td>课程名：</td>
            <td>
                <input required  type='text' id='coursename' name='coursename' >
            </td>
        </tr>
        <tr>
            <td>班级：</td>
            <td>
                <input required  type='text' id='clazz' name='clazz' >
            </td>
        </tr>
        <tr>
            <td>教师：</td>
            <td>
                <input required type='text' id='tname' name='tname' >
            </td>
        </tr>
        <tr><td colspan='2'>
                <div align='center'>
                     <input type='submit'  value='添加'>
                     <input type='reset' value='重置'>
                 </div>
            </td>
        </tr>
    </table>
</form>
<%@include file="common/foot.jsp" %>
</body>
</html>
